﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UClaimDemageControlAdd.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.UserModel.UClaimDemageControlAdd" %>
<div class="pageContent">
	<form method="post" action="UserModel/UClaimDemageControlAdd.aspx?ajaxmethod=add" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
		<div class="pageFormContent UClaimDemageControlAdd"  layoutH="56">			
            <div  class="titleshowlegent">
            索赔单信息
           </div>
           <p>
				<label>品情单号：</label>
				<input id="UClaimDemageControlAddClaimsNumber" name="ClaimsNumber"  type="text" class="required"  value="" />
			</p>
            <p>
				<label>机号：</label>
				<input name="SerialNumber"  type="text" class="required"  value=""  onblur="UClaimDemageControlAdd_GetIntoDate($(this))" />
			</p>
            <p>
				<label>接到故障日：</label>
				<input name="FaultDate" class="required date" type="text" value="<%=DateTime.Now.ToString("yyyy-MM-dd") %>" alt=""/>
			</p>
             <p>
				<label>代理商：</label>
			     <input type="text" name="AgentName" class="required autocomplete" alt=""  autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getagentlist&showtype=CardCode" mustMatch="false" swidth="300" showinputid=""/>
               
			</p>
            <div class="divider"></div>
            <p>
				<label>交机日期：</label>
				<input id="UClaimDemageControlAdd_IntoDate" name="IntoDate"  type="text" class="" readonly  value="" />
			</p>
            <div class="divider"></div>
           <p>
				<label>用户：</label>
				<input name="CustomerName"  type="text" class=""  value="" />
			</p>
            <p>
				<label>机型：</label>
				<%=GetMacType("select","MachineType","65NS")%>
			</p>
            <p>
				<label>工作小时 ：</label>
				<input name="WorkHour"  type="text" class="inputFloat"  value="0" />
			</p>
            <div class="divider"></div>
            <dl class="nowrap">
				<dt>故障描述：</dt>
                <dd><textarea name="FaultDescription" style="width:250px; height:30px;"></textarea></dd>               
            </dl>
            <div class="divider"></div>
            <dl class="nowrap">
				<dt>处理方式：</dt>
                <dd><textarea name="ProcessMode" style="width:250px; height:30px;"></textarea></dd>               
            </dl>
            <% if (HasPower(IHISCETeim.Web.Permission.索赔管控_责任归属初判))
               {%>
           <div  class="titleshowlegent">
            责任归属初判
           </div>
           <table style="width: 100%;" class="mylist">
                <thead>                    
                    <tr>
                        <th>归属1</th>
                        <th>归属2</th>
                        <th>
                            归属3
                        </th>
                         <th>
                            归属4
                        </th>
                        <th>归属5</th>
                        <th>归属6(IHISCE责任)</th>
                    </tr>
                 </thead>
                 <tbody>
                    <tr class="mytr">
                        <td >
                             <input name="DutyPanDing"  type="text" class="autocomplete"  value=""  autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getsupplierlist" swidth="300px" showinputid=""/>                  
                        </td>
                        <td >
                             <input name="DutyPanDing"  type="text" class="autocomplete"  value=""  autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getsupplierlist" swidth="300px" showinputid=""/>                    
                        </td>
                        <td >
                             <input name="DutyPanDing"  type="text" class="autocomplete"  value=""  autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getsupplierlist" swidth="300px" showinputid=""/>                    
                        </td>
                        <td >
                          <input name="DutyPanDing"  type="text" class="autocomplete"  value=""  autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getsupplierlist" swidth="300px" showinputid=""/>
                        </td>

                         <td>
                           <input name="DutyPanDing"  type="text" class="autocomplete"  value=""  autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getsupplierlist" swidth="300px" showinputid=""/>
                        </td>

                        <td>
                            <select name="DutyPanDing">
                                <option value="">请选择....</option>
                                <option value="厂内责任">厂内责任</option>
                                <option value="营业政策性索赔" >营业政策性索赔</option>
                                <option value="特殊索赔约定" >特殊索赔约定</option>
                                <option value="其它" >其它</option>
                                <option value="专案件">专案件</option>
                                <option value="试制件">试制件</option>
                                <option value="服务索赔">服务索赔</option>
                                <option value="服务政策性索赔">服务政策性索赔</option>
                            </select>
                        </td>
                    
                    </tr>
                 </tbody>
            </table>
            <%} %>
           <div  class="titleshowlegent">
            索赔费成本(RMB)
           </div>
            <p>
                <label style="width:160px!important;">1.IHISCE配件发货运费:</label>
                <input name="SendPartTransportCost"  type="text" class="inputFloat"  value="0" />
            </p>
            <div style="clear:both; width:100%!important;">
                <table style="">
                    <tr>
                        <td>2.代理商索赔费(RMB):</td>
                        <td>是否已提交:</td>
                        <td><input type="checkbox" name="AgentIsSubmit" value="true" /></td>
                        <td>批复时间：</td>
                        <td><input name="PiFuDate" class="date" value="" /></td>
                    </tr>
                    <tr>
                        <td>3.派工次数：</td>
                        <td colspan="4">
                            <select name="PaiGongCiShu">
                                <option value=1 selected>派工1次</option>
                                <option value=2>派工2次</option>
                                <option value=3>派工3次</option>
                                <option value=4>派工4次</option>
                            </select>
                        </td>
                    </tr>
                </table>
              
                
            </div>
           <table style="clear:both;width: 100%;" class="mylist">
                <thead>                    
                    <tr>
                        <th>外购费</th>
                        <th>工时费</th>
                        <th>
                            出车费
                        </th>
                         <th>
                            差旅费
                        </th>
                        <th>运输费邮寄费</th>
                        <th>其他</th>
                    </tr>
                 </thead>
                 <tbody>
                    <tr class="mytr">
                        <td >
                             <input name="AgentPartCost"  type="text" class="inputFloat"  value="0" />                  
                        </td>
                        <td >
                             <input name="AgentWorkCost"  type="text" class="inputFloat"  value="0" />                    
                        </td>
                        <td >
                             <input name="AgentOutCost"  type="text" class="inputFloat"  value="0" />                    
                        </td>
                        <td >
                          <input name="AgentTravelCost"  type="text" class="inputFloat"  value="0" />
                        </td>

                         <td>
                           <input name="AgentTransportCost"  type="text" class="inputFloat"  value="0"      
                        </td>

                        <td>
                            <input name="AgentOtherCost"  type="text" class="inputFloat"  value="0" />
                        </td>
                    
                    </tr>
                 </tbody>
            </table>
           
           <div  class="titleshowlegent">
                故障件的物料(请输入原材料物料号码)
           </div>
           <table style="clear:both;width: 100%;" class="mylist">
                <tr>
                    <th width="40%">原材料号码</th>
                    <th>数量</th>
                </tr>
                <tr>
                    <td>
                        <input type="text" name="DetailItemCode" value="" />
                    </td>
                    <td>
                        <input type="text" name="DetailQuantity" class="inputFloat" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="text" name="DetailItemCode" value="" />
                    </td>
                    <td>
                        <input type="text" name="DetailQuantity" class="inputFloat" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="text" name="DetailItemCode" value="" />
                    </td>
                    <td>
                        <input type="text" name="DetailQuantity" class="inputFloat" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="text" name="DetailItemCode" value="" />
                    </td>
                    <td>
                        <input type="text" name="DetailQuantity" class="inputFloat" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="text" name="DetailItemCode" value="" />
                    </td>
                    <td>
                        <input type="text" name="DetailQuantity" class="inputFloat" value="" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="text" name="DetailItemCode" value="" />
                    </td>
                    <td>
                        <input type="text" name="DetailQuantity" class="inputFloat" value="" />
                    </td>
                </tr>
           </table>
		</div>
		<div class="formBar">
			<ul>
				
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>
<script>
    $(document).ready(function () {
        $("#UClaimDemageControlAddClaimsNumber").blur(function () {
            var $data = {};
            var $this = $(this);
            $data["ClaimsNumber"] = $this.val();
            var url = "/AgentSys/ajaxDone.ashx?ajaxmethod=getagnetqlty"
            $.ajax({
                type: 'post',
                url: url,
                data: $data,
                async: false,
                cache: false,
                dataType: 'json',
                success: function (json) {
                    if (json.QltyId <= 0) {
                        alertMsg.warn('在经销商终端平台没有找到此品情信息.');
                        //$("#AddAgentQlty2_BtnSave").find("button").attr("disabled", "disabled");
                       // $(".UClaimDemageControlAdd").
                        return;
                    }
                    //$("#AddAgentQlty2_BtnSave").find("button").removeAttr("disabled");
                    for (var itm in json) {
                        if (itm == "FaultDate") {
                            $(".UClaimDemageControlAdd").find("[name='" + itm + "']").val(formatterdate(json[itm]));
                        }
                        else {
                            $(".UClaimDemageControlAdd").find("[name='" + itm + "']").val(json[itm]);
                        }

                    }
                }
            });
        });


    });

    /*1.json日期格式转换成 yyyy-MM-dd*/
    function formatterdate(val, row) {

        if (val == null || val == undefined || val == "") {
            return "";
        }
        return val.substr(0, 10);
        var match;
        if (!(match = val.match(/\d+/))) {
            return "";
        }
        var dt = new Date();
        dt.setTime(match[0] - 0);
        var str = "";
        if (dt.getFullYear) {
            var y, m, d;
            y = dt.getFullYear();
            m = dt.getMonth() + 1; //1-12
            m = "" + m;
            d = "" + dt.getDate();
            if (m.length != 2) {
                m = "0" + m;
            }
            if (d.length != 2) {
                d = "0" + d;
            }
            str = "" + y + "-" + m + "-" + d;
        }
        return str;
    }

    function UClaimDemageControlAdd_GetIntoDate($obj) {
        var $data = {};
        var $this = $obj;
        $data["SerialNumbert"] = $this.val();
        var url = "/MachineSys/sysAjaxDone.ashx?ajaxmethod=getuwarrantycardbyserialnumbert"
        $.ajax({
            type: 'post',
            url: url,
            data: $data,
            async: false,
            cache: false,
            dataType: 'json',
            success: function (json) {

                $("#UClaimDemageControlAdd_IntoDate").val(json.IntoDate);
            }
        });
    }
</script>